package org.xtframe.service;

import org.xtframe.bean.SystemConfig;
import org.xtframe.util.SpringUtil;

public class AjaxDataFactory {
	public static AjaxDataHandler createAjaxDataHandle(int iFunc){
		AjaxDataHandler ajaxDataHandle = null;
		switch(iFunc){
			// 注册
			case SystemConfig.FUNC_REGISTER:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("registerDataHandler");
				break;
			// 用户登录
			case SystemConfig.FUNC_LOGIN:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("loginDataHandler");
				break;
			// 退出登录
			case SystemConfig.FUNC_LOGOUT:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("logoutDataHandler");
				break;
			// 执行sql查询方法
			case SystemConfig.FUNC_EXECUTEQUERY:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("executeQueryDataHandler");
				break;
			// 执行sql更新方法
			case SystemConfig.FUNC_EXECUTEUPDATE:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("executeUpdateDataHandler");
				break;
			// 执行sql自增主键的插入方法
			case SystemConfig.FUNC_INSERT:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("insertDataHandler");
				break;
			// 执行sql事务提交
			case SystemConfig.FUNC_EXECUTETRANSACTION:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("executeTransactionDataHandler");
				break;
			// 执行存储过程
			case SystemConfig.FUNC_PREPARECALL:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("prepareCallDataHandler");
				break;
			// 执行批量查询
			case SystemConfig.FUNC_EXECUTEQUERYTRANSACTION:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("executeQueryTransactionDataHandler");
				break;
			// 获取菜单
			case SystemConfig.FUNC_MENU:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("menuDataHandler");
				break;
			// 刷新服务器加载数据
			case SystemConfig.FUNC_SERVER_BREAK:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("serverBreakDataHandler");
				break;
			// 获取当前用户信息
			case SystemConfig.FUNC_USERINFO:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("userInfoDataHandler");
				break;
			// 获取服务器数据
			case SystemConfig.FUNC_SERVER_DATA:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("serverDataDataHandler");
				break;
			// 批量获取服务器数据
			case SystemConfig.FUNC_SERVER_DATA_LIST:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("serverDataListDataHandler");
				break;
			// 分页查询数据
			case SystemConfig.FUNC_PAGING:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("pagingDataHandler");
				break;
			
			// 获取流程定义列表
			case SystemConfig.FUNC_PROCESSDEFINITION_LIST:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("processDefinitionListDataHandler");
				break;
			// 获取流程实例列表
			case SystemConfig.FUNC_PROCESSINSTANCE_LIST:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("processInstanceListDataHandler");
				break;
			// 获取任务列表
			case SystemConfig.FUNC_TASK_LIST:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("taskListDataHandler");
				break;
			// 开启流程
			case SystemConfig.FUNC_STARTPROCESS:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("startProcessDataHandler");
				break;
			// 流程图信息
			case SystemConfig.FUNC_PROCESSVIEW:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("processViewDataHandler");
				break;
			// 完成任务
			case SystemConfig.FUNC_COMPLETETASK:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("completeTaskDataHandler");
				break;
			// 任务页面
			case SystemConfig.FUNC_TASKPAGE:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("taskPageDataHandler");
				break;
			// 删除部署
			case SystemConfig.FUNC_DELETEDEPLOYMENT:
				ajaxDataHandle = (AjaxDataHandler) SpringUtil.getBean("deleteDeploymentDataHandler");
				break;
		}
		return ajaxDataHandle;
	}
}

